import VueRouter from 'vue-router'
import Login from '../view/Login.vue'
import Register from '../view/Regiter.vue'
import Home from '../view/Home.vue'
import notFound from '@/view/404.vue'

const router = new VueRouter({
    routes:[
        {
            path:'/',
            redirect:"/UserLogin"
        },
        {
            path:"/UserLogin",
            component:Login,
            meta:{title:"用户登陆"}
        },
        {
            path:"/UserRegister",
            component:Register,
            meta:{title:"用户注册"}
        },
        {
            path:"/Home",
            component:Home,
            meta:{title:"主页"}
        },
        {
            path:"/404",
            component:notFound,
            meta:{title:"Not Found"}
        },
        {   
            path:"*",
            redirect:'/404'
        }
    ]
})

router.afterEach((to,form)=>{
    document.title = to.meta.title
})


export default router